package lab01;

public class Test13 {
    public static void main(String[] args) {
        System.out.println("1-1000以内的水仙花数如下：");

        for (int i = 1; i < 1000; i++) {

            //首先判断是否为三位数

            if (i / 100 != 0) {
                int one = i % 10;
                int ten = i / 10 % 10;
                int hun = i / 100 % 10;

                //判断它的各位数字的立方和是否等于这个三位数本身

                if (i == one * one * one + ten * ten * ten + hun * hun * hun) {
                    System.out.print(i+" ");
                }
            }
        }
    }
}

